package com.china.milkywayeye.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @Program: java-ceshiuse
 * @ClassName: SysResult
 * @Description: 与前端做交互的标准数据类型
 * @Author: milkywayeye
 * @Create: 2024-03-05 11:14
 * @Version: v1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class SysResult {
    private Integer code;
    private String message;
    private Object data;

    public static SysResult success() {
        return new SysResult(200, "服务调用成功", null);
    }

    public static SysResult success(String message) {
        return new SysResult(200, message, null);
    }

    public static SysResult success(Object data) {
        return new SysResult(200, "服务调用成功", data);
    }

    public static SysResult success(String message, Object data) {
        return new SysResult(200, message, data);
    }

    public static SysResult fail() {
        return new SysResult(201, "服务调用失败", null);
    }

    public static SysResult fail(String message) {
        return new SysResult(201, message, null);
    }

    public static SysResult diy(Integer code, String message) {
        return new SysResult(code, message, null);
    }
}
